<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of InStock
 *
 * @author Administrator
 */
class Stock extends WMS_Controller
{

    public function __construct()
    {
        parent::__construct();
        $userData = $this->session->userdata('users');
        $this->whsCode = $userData['user_main_whs_code'];
        $this->load->service('wms/in_out_type_service');
        $this->load->service('wms/mt_server');
        $this->load->service('/wms/warehouse_list_service');
    }

    function inStock()
    {
        $data['whsCode'] = $this->warehouse_list_service->fields_whs_array($this->whsCode);
        $data['in_out_type'] = $this->in_out_type_service->get_in_types();
        $this->load->view('defaults/wms/in_stock_panel', $data);
        $this->load->view('defaults/common/footer');
    }

    function outStock()
    {
        $data = $gp = gp();
        $whs_code = $gp['whs_code'] ? $gp['whs_code'] : $this->whsCode;
        $sku = $gp['sku'] ? $gp['sku'] : '';
        $pid = $gp['pid'] ? $gp['pid'] : '';
        $order_num = $gp['order_num'] ? $gp['order_num'] : '';
        $page = $gp['page'] ? intval($gp['page']) : 1;
        $str = '?';
        if ('' != $sku)
        {
            $str .= 'sku=' . $sku;
        }
        if ('' != $pid)
        {
            $str .= '&pid=' . $pid;
        }
        if ('' != $order_num)
        {
            $str .= '&order_num=' . $order_num;
        }
        //分页查询
        $this->load->library('pagination');
        $config['page_query_string'] = TRUE;
        $config['base_url'] = blang_url('wms/Stock/outStock' . $str);
        $config['total_rows'] = $this->mt_server->get_canout_pid($is_count = true, $whs_code, $order_num, $pid, $sku);
        $config['uri_segment'] = config_item('enable_lang') ? 5 : 4;
        $config['per_page'] = 20;
        $this->pagination->initialize($config);
        $data['pageShow'] = $this->pagination->create_links();
        //分页结束
        //获取产品库存列表
        $list = $this->mt_server->get_canout_pid($is_count = false, $whs_code, $order_num, $pid, $sku, ($page - 1) * $config['per_page'], $config['per_page']);
        //构建前端数据
        $data['outList'] = $list;

        $data['whsCode'] = $this->warehouse_list_service->fields_whs_array($this->whsCode);
        $data['in_out_type'] = $this->in_out_type_service->get_out_types();

        $this->load->view('defaults/wms/out_stock_panel', $data);
        $this->load->view('defaults/common/footer');
    }

    function zcsq_in()
    {
        $data['whsCode'] = $this->warehouse_list_service->fields_whs_array($this->whsCode);
        $data['in_out_type'] = $this->in_out_type_service->get_verify_in_types();
        $this->load->view('defaults/wms/in_zcsq_panel', $data);
        $this->load->view('defaults/common/footer');
    }

    function zcsq_out()
    {
        $data['whsCode'] = $this->warehouse_list_service->fields_whs_array($this->whsCode);
        $data['in_out_type'] = $this->in_out_type_service->get_verify_out_types();
        $this->load->view('defaults/wms/out_zcsq_panel', $data);
        $this->load->view('defaults/common/footer');
    }

}

?>
